﻿using brand.cyt369.com.models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace brand.cyt369.com.dal
{
    public class HotBrandService: brand.cyt369.com.dal.DbContexts.BrandBaseService<HotBrandService>
    {
        public HotBrandService() { }
        /// <summary>
        /// 获取热门加盟前10
        /// </summary>
        /// <returns></returns>
        public IQueryable<brand.cyt369.com.models.HotBrand> HotBrandTop36Gets()
        {
            using (var ctx = this.BrandCtx)
            {
                var hotbrand = (from o in ctx.HotBrands.
                                Include(c => c.Brand)
                                .ThenInclude(c=>c.BrandImages)
                                .Where(c=>c.Brand.ReviewResult==1)select o)
                             .OrderBy(c=>c.OrderNumber)
                             .Take(36);
                return hotbrand.ToList().AsQueryable();
            }
        }
    }
}
